package com.bulemobi.activity.ac_user_centre;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.PopupWindow;
import com.jsyh.hcb.R;

@SuppressLint("NewApi")
public class ChoiceSeatType extends PopupWindow implements OnClickListener {

    public GetSeatType gst;
    Button tv_daka;
    Button tv_sanzuo;

    public ChoiceSeatType(Activity ac, GetSeatType gst) {
        this.gst = gst;
        View view = LayoutInflater.from(ac).inflate(R.layout.pop_seat_type,
                null);
        tv_daka = (Button) view.findViewById(R.id.tv_daka);
        tv_sanzuo = (Button) view.findViewById(R.id.tv_sanzuo);
        tv_daka.setOnClickListener(this);
        tv_sanzuo.setOnClickListener(this);
        setContentView(view);
        setWidth(LayoutParams.WRAP_CONTENT);
        setHeight(LayoutParams.WRAP_CONTENT);
        setOutsideTouchable(true);
    }

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        if (isShowing()) {
            dismiss();
        }
        if (arg0.getId() == tv_daka.getId()) {
            AddCarActivity.markType = "01";
        } else if (arg0.getId() == tv_sanzuo.getId()) {
            AddCarActivity.markType = "02";
        }
        gst.getSeatType(((Button) arg0).getText() + "");
//		Resource.roomType = ((Button) arg0).getText() + "";
    }

    /**
     * @author sunsy 2014�?�?�?20:11:06 显示
     */
    public void show(View parentView) {
        if (!isShowing()) {
            showAsDropDown(parentView, 0, 0);
            //showAtLocation(parentView, Gravity.RIGHT, 0, 0);
        }
    }

    public interface GetSeatType {
        public void getSeatType(String text);
    }

}
